<#include 'layout/template.ftl'/>
<@htmlHead title=''>
	<!-- page specific plugin styles -->
	<link rel="stylesheet" href="${resources}/assets/css/jquery-ui.css" />
	<link rel="stylesheet" href="${resources}/assets/css/datepicker.css" />
	<link rel="stylesheet" href="${resources}/assets/css/ui.jqgrid.css" />
	<link rel="stylesheet" href="${resources}/plugins/jqgrid/4.6/jqgrid.extend.css" />
</@htmlHead>


<@htmlBody 'merchant'  'picked'   >

	<#include 'layout/breadcrumbs.ftl'>
	<@breadcrumbs '管理'   '列表'></@breadcrumbs>

	<!-- page-content begin -->
	<div class="page-content">
			
			<!-- page-header begin -->
			<div class="page-header">
					<h1>
						列表
					</h1>
			</div>
			<!-- page-header end -->


			<div class="row">
				<div class="col-md-12">	
					<div id="opt"> 
					    <div id="query"> 
				       		<label>名称：</label><input type="text" class="input-sm" id="name" /> 
				            <input type="submit" class="btn btn-sm btn-primary" id="find_btn" value="查 询" /> 
					       <a href="${path}/manage/bank/picked/create" class="btn btn-sm btn-primary">新增</a>
					    </div>
					</div> 
				</div>	
			</div>
			
			<!-- form begin -->
			<div class="row">	
				<div class="col-md-12">
					<!-- jqGrid begin -->
				  	<table id="grid-table"></table>
			 		<div id="grid-pager"></div>
			 		<!-- jqGrid end -->
	
				</div>
			</div>	
			<!-- form end -->
	</div>		
	<!-- page-content end -->	


</@htmlBody>

<@htmlBodyScript>

		<script src="${resources}/assets/js/date-time/bootstrap-datepicker.js"></script>
		<script src="${resources}/assets/js/jqGrid/jquery.jqGrid.src.js"></script>
		<script src="${resources}/assets/js/jqGrid/i18n/grid.locale-cn.js"></script>

		<script>
			var $path ='${path}';
			var grid_selector = "#grid-table";
			var pager_selector = "#grid-pager";
			
			//价格
         	function formatPrice(cellValue, options, rowObject) {
         		return accounting.formatMoney(cellValue, "¥", 2, ",", ".");
    		}
    		//数量
         	function formatNumber(cellValue, options, rowObject) {
         		return accounting.formatNumber(cellValue);
    		}
    		//时间
			function formatDatetime(cellValue, options, rowObject) {
				var output = moment(cellValue).format('YYYY-MM-DD HH:mm:ss');
				return output;
			}
			//状态
			function formatStatus(cellValue, options, rowObject) {
         		var option = '<div class="ui-status">';
				if(cellValue==1){
					option+= "<span class='label label-sm label-success'>正常</span>";
				}
				else if(cellValue==2){
					option+= "<span class='label label-sm label-danger'>停用</span>";
				}
				option = option +'</div>';      
           		return option;
    		}
				
			$(function(){

				//分页插件开始
				$("#grid-table").jqGrid({
					url: '${path}/manage/bank/picked/list',
				 	mtype : "post", 
					datatype: "json",
					//prmNames : {search : "search"},  
					colNames:[	'ID','地址','商圈','银行','状态','创建时间','操作'],
				 	colModel: [
						{name:'id', width:100},
						{name:'address', width:100},
						{name:'district.name', width:100},
						{name:'corp.name', width:100},
						{name:'status', width:100,formatter:formatStatus},
						{name:'createTime', width:100,formatter:formatDatetime},
						{
							name:'id', 
							width:150,
							formatter:function(cellvalue, options, rawObject) {
					    		var option = '<div class="ui-op">';
					    		option = option +'<a href="${path}/manage/bank/picked/update/'+cellvalue+'">编辑'; 
				                option = option +'</a>';
			                   	if(rawObject.status!=2){ 
					                option = option +'<a href="${path}/manage/bank/picked/disable/'+cellvalue+'"  onclick=\'return confirm("是否停用?");\'>停用';
				                	option = option +'</a>';  
			                	}
			                	if(rawObject.status!=1){ 
					                option = option +'<a href="${path}/manage/bank/picked/enable/'+cellvalue+'"  onclick=\'return confirm("是否启用?");\'>启用';
				                	option = option +'</a>';  
			                	}
					    		option = option +'<a href="${path}/manage/bank/picked/delete/'+cellvalue+'"  onclick=\'return confirm("是否删除?");\'>删除';
				                option = option +'</a>';
				                option = option +'</div>';      
			               		return option;  
							}
						}
					],
					viewrecords: true, 							// 在toolbar显示的当前页数,步长,总数
					autowidth: true,  
              		shrinkToFit: true,  	
					height: "450",
					rowNum: 50,
					rowList:[10,50,100],
					sortname: 'id',
					sortorder: 'asc',
					pager: "#grid-pager",
					caption: "列表",
					loadComplete : function() {
						var table = this;
						setTimeout(function(){
							styleCheckbox(table);
							updateActionIcons(table);
							updatePagerIcons(table);
							enableTooltips(table);
						}, 0);
					}
					
				});
				//分页插件结束
				
				//------------------------------- 自定义查询开始 -------------------------------
				//自定义查询开始
				$("#find_btn").click(function(){ 
					searchData('${path}/manage/bank/picked/list');
			    }); 
				//自定义查询结束
				
			})
		</script>	
	    <script src="${resources}/assets/js/jqGrid/jquery.jqGrid.Extract.js"></script>
	    

</@htmlBodyScript>	


